#!/bin/bash
MYIPS=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`

#if [ "$MYIPS" == "" ]; then
#  espeak -w /tmp/ip.wav "Could not connect to network"
#  play /tmp/ip.wav 
#  exit 
#fi
 
#for ip in $MYIPS; do
#  printf "Local IP: %s \n" $ip
#  espeak -w /tmp/ip.wav $ip
#  play /tmp/ip.wav 
#  rm /tmp/ip.wav 2>/dev/null
#done

if [ "$MYIPS" == "" ]; then
  /opt/hifiberry/bin/bootmsg "Could not connect to network"
else
 IPLIST=""
 for IP in $MYIPS; do
  IPLIST="$IPLIST $IP"
 done
 /opt/hifiberry/bin/bootmsg "IP address: $IPLIST"
fi
